<!DOCTYPE HTML>
<html>
<head>
<script src="../js/jquery/jquery-3.1.1.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Insert title here</title>
</head>
<body>
    生成的验证码：<img id="changeCaptcha" src="http://127.0.0.1:8080/captcha/getCaptchaCode.html" /> <a href="javascript:changeCaptcha()">看不清，换一张</a>
    <br/>
    <br/>
    请输入验证码：<input id="captchaCode" type="text" /> <input type="button" value="提交验证" onclick="checkCaptcha()" />
</body>
<script type="text/javascript">
//获取验证码图片 
function changeCaptcha(){
    $("#changeCaptcha").attr("src","/captcha/getCaptchaCode.html");
}
//验证输入的验证码 
function checkCaptcha(){
    var captchaCode = $("#captchaCode").val();
    $.ajax({
        type:'post',
        async : false,
        url:'http://127.0.0.1:8080/captcha/checkCaptchaCode.html',
        data:{"captchaCode" : captchaCode},
        success:function(res){
            alert(res);
        }
    });
}
</script>
</html>